package com.houduan.model;

import java.util.Date;

public class Order {
    private int orderId;       // 订单编号
    private User user;         // 用户对象（关联的用户）
    private double amount;     // 订单金额
    private String status;     // 订单状态（例如：未支付、已支付、已取消）
    private Date createTime;   // 订单创建时间

    // 默认构造函数
    public Order() {}

    // 带参数的构造函数
    public Order(int orderId, User user, double amount, String status, Date createTime) {
        this.orderId = orderId;
        this.user = user;
        this.amount = amount;
        this.status = status;
        this.createTime = createTime;
    }

    // Getter 和 Setter 方法
    public int getOrderId() {
        return orderId;
    }

    public void setOrderId(int orderId) {
        this.orderId = orderId;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public double getAmount() {
        return amount;
    }

    public void setAmount(double amount) {
        this.amount = amount;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    // 重写 toString 方法，便于调试和输出订单信息
    @Override
    public String toString() {
        return "Order{" +
                "orderId=" + orderId +
                ", user=" + user +
                ", amount=" + amount +
                ", status='" + status + '\'' +
                ", createTime=" + createTime +
                '}';
    }
}
